//
//  NewsCellStudy.m
//  Cunli
//
//  Created by lilubin on 15/7/7.
//  Copyright (c) 2015年 lilubin. All rights reserved.
//

#import "NewsCellStudy.h"
#import "NewsModel_yy.h"
#import "UIImageView+WebCache.h"
#import "DeviceInfoClass.h"

@implementation NewsCellStudy

- (void)awakeFromNib {
    // Initialization code
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    NSURL *picURL = [NSURL URLWithString:_newsModel.picURLStr];
    [_titleImgView setImageWithURL:picURL placeholderImage:[UIImage imageNamed:@"default_news"]];
    _titleLabel.text = _newsModel.title;
    _introduceLabel.text = _newsModel.introduce;
    [_typeLabel setBackgroundColor:[UIColor colorWithHexString:@"0x2fa9f4"]];
    
    [_titleLabel setTextColor:[UIColor colorWithHexString:InfoCellTitleColorValue]];
    [_introduceLabel setTextColor:[UIColor colorWithHexString:InfoCellIntroduceColorValue]];
 
    if ([DeviceInfoClass getCurrentDeviceDetailVersion] == DeviceInfoVersioniPhone4s || [DeviceInfoClass getCurrentDeviceDetailVersion] == DeviceInfoVersioniPhone5s) {
        [_titleLabel setFont:[UIFont systemFontOfSize:16.0f]];
        [_introduceLabel setFont:[UIFont systemFontOfSize:13.0f]];
    }
}

- (void)setNewsModel:(NewsModel_yy *)newsModel
{
    _newsModel = newsModel;
    NSURL *imgURL = [NSURL URLWithString:newsModel.picURLStr];
    [_titleImgView setImageWithURL:imgURL placeholderImage:[UIImage imageNamed:@"default_news"]];
    _titleLabel.text = _newsModel.title;
    _introduceLabel.text = _newsModel.introduce;
}



@end
